package com.example.leetdemo.finash;

public class Solution2319 {

    public boolean checkXMatrix(int[][] grid) {
        boolean check = true;
        for (int i = 0; i < grid.length; i++) {
            if (!check) {
                break;
            }
            for (int j = 0; j < grid[i].length; j++) {
                if (i == j || j == grid.length - i - 1) {
                    if (grid[i][j] == 0) {
                        check = false;
                        break;
                    }
                } else {
                    if (grid[i][j] != 0) {
                        check = false;
                        break;
                    }
                }
            }
        }
        return check;
    }

}
